﻿@using MvcJqGrid;
@{
    ViewBag.Title = "Index";
}

    @Styles.Render("~/bundles/styles/jqGrid")
    @Scripts.Render("~/bundles/scripts/jqgrid")

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@(Html.Grid("partyGrid")
    .SetRequestType(MvcJqGrid.Enums.RequestType.Post)
    .SetJsonReader(new MvcJqGrid.DataReaders.JsonReader { Id = "ID", RepeatItems = false })
    .SetCaption("Party")
    .AddColumn(new Column("FirstName"))
    .AddColumn(new Column("LastName"))
    .AddColumn(new Column("Phone"))
    .AddColumn(new Column("Address"))
    .AddColumn(new Column("CreditLimit"))
    .AddColumn(new Column("ModeOfPayment"))
    .AddColumn(new Column("PartyStatus"))
    .SetUrl(Url.Action("Search", "Party"))
    .SetAutoWidth(true)
    .SetRowNum(10)
    .SetRowList(new[] { 10, 15, 20, 50 })
    .SetViewRecords(true)
    .SetPager("pager")
    )

@*<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.FirstName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.LastName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Phone)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Address)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.City)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Country)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreditLimit)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ModeOfPayment)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PartyStatus)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.FirstName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.LastName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Phone)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Address)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.City)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Country)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CreditLimit)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ModeOfPayment)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PartyStatus)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
            @Html.ActionLink("Details", "Details", new { id = item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.ID }, new { @class = "confirmDialog", id = item.ID })
            </td>
        </tr>
    }

</table>*@
<div id="dialog-confirm" style="display: none">
    <p>
        <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
        Are you sure to delete ?
    </p>
</div>
